#ifndef AXISTILEDMAPVIEW_H
#define AXISTILEDMAPVIEW_H

#include <QGraphicsView>
#include <QEvent>
#include <QMouseEvent>
#include <QGLWidget>
#include <QObject>
#include <QScrollBar>
#include <QPinchGesture>

class AxisTiledMapScene;

class AxisTiledMapView : public QGraphicsView
{
    Q_OBJECT

public:
    AxisTiledMapView(QWidget* parent = nullptr);
    ~AxisTiledMapView();

    AxisTiledMapScene *mapScene() const;
    bool handScrolling() const { return _handscrolling; }
    void setHandScrolling(bool b);

protected:
    void mousePressEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void wheelEvent(QWheelEvent* event);
    void handlePinchGesture(QPinchGesture* pinch);
    void adjustCenterFromMousePosition(QPoint& mousepos);
    bool event(QEvent* e);

protected:
    QPoint _lastmousepos;
    QPointF _lastmousescenepos;
    bool _handscrolling = false;

};

#endif // AXISTILEDMAPVIEW_H
